#include "DrawTool.h"
#include "ui_DrawTool.h"

const char *tool = "tool";

DrawTool::DrawTool(QWidget *parent) :
	QWidget(parent),
	ui(new Ui::DrawTool)
{
	ui->setupUi(this);

	ui->btnPixel->setProperty(tool, (int)eToolPosition);
	ui->btnOval->setProperty(tool, (int)eToolOval);
	ui->btnRect->setProperty(tool, (int)eToolRect);
	ui->btnLine->setProperty(tool, (int)eToolLine);
	ui->btnPen->setProperty(tool, (int)eToolPen);
	ui->btnText->setProperty(tool, (int)eToolText);
	ui->btnZoom->setProperty(tool, (int)eToolZoom);
	ui->btnLength->setProperty(tool, (int)eToolLength);
	ui->btnReset->setProperty(tool, (int)eToolReset);
}

DrawTool::~DrawTool()
{
	delete ui;
}

void DrawTool::SlotClick()
{
	if(this->sender())
	{
		QPushButton *pBtn = qobject_cast<QPushButton*>(this->sender());

		if(pBtn)
		{
			emit SignalClickTool((ETool)pBtn->property(tool).toInt());
		}
	}
}
